export const validatorPhone = function (rule, value, callback) {
  if (value === "") {
    callback(new Error("手机号不能为空"));
  } else if (!/^1\d{10}$/.test(value)) {
    callback(new Error("手机号格式错误"));
  } else {
    callback();
  }
};

export const validatorEmail = function (rule, value, callback) {
  if (value === "") {
    callback(new Error("邮箱不能为空"));
  } else if (
    !/^[A-Za-z0-9-._]+@[A-Za-z0-9-]+(.[A-Za-z0-9]+)*(.[A-Za-z]{2,6})$/.test(
      value
    )
  ) {
    callback(new Error("邮箱格式错误"));
  } else {
    callback();
  }
};
